package Dungeoneering.Utils;

import org.powerbot.game.api.wrappers.node.SceneObject;

/**
 * Basicly this is our Constants class. All the Object id's are hardcoded here, so we can easely check what kind of object something is.
 * @author Nicolaas
 *
 */
public class Validator {
	
	private static final int GUARDIAN_DOOR_FROZEN = 50346;
	private static final int GUARDIAN_DOOR_ABANDONED = 50347;
	private static final int GUARDIAN_DOOR_FURNISHED = 50348;
	private static final int GUARDIAN_DOOR_OCCULT = 53949;
	private static final int GUARDIAN_DOOR_WARPED = 55763;
	
	private static final int LADDER_FROZEN = 49696;
	private static final int LADDER_ABANDONED = 49698;
	private static final int LADDER_FURNISHED = 49700;
	private static final int LADDER_OCCULT = 53748;
	private static final int LADDER_WARPED = 55484;
	
	private static final int[] GUARDIAN_DOORS = {GUARDIAN_DOOR_FROZEN, GUARDIAN_DOOR_ABANDONED, GUARDIAN_DOOR_FURNISHED, GUARDIAN_DOOR_OCCULT, GUARDIAN_DOOR_WARPED};
	
	private static final int[] DEFAULT_DOORS = {GUARDIAN_DOOR_FROZEN - 1, 50343, GUARDIAN_DOOR_FURNISHED - 1, GUARDIAN_DOOR_OCCULT - 1, GUARDIAN_DOOR_WARPED - 1};
	
	private static final int[] END_LADDERS = {LADDER_FROZEN, LADDER_ABANDONED, LADDER_FURNISHED, LADDER_OCCULT, LADDER_WARPED};
	
	private static final int[] NON_DOOR_OBJECTS = 	{ 50036, 50574, 50603, 50657, 51060, 49697, 53750, 51061, 54673, 54776, 54777, 49703, 
		  54784, 53844, 53747, 55992, 56145, 56150, 55993, 55127, 53765, 55106, 53769, 55512, 49743, 53767, 54674, 
		  51062, 50716, 56150, 55994, 55485, 56152, 54597, 54575, 56151, 55476, 56209, 55483, 51703, 51155, 
		  50035, 51610, 51608, 50035, 51207, 52153, 49699, 51815, 52155, 51756, 50037, 49704 };
	
	public static boolean isValidDoor(SceneObject obj) {
		if (occursInArray(obj.getId(), NON_DOOR_OBJECTS))
			return false;
		return true;
	}
	
	public static boolean isGuardianDoor(SceneObject obj) {
		return occursInArray(obj.getId(), GUARDIAN_DOORS);
	}
	
	private static boolean occursInArray(int id, int idList[]) {
		for (int i : idList) {
			if (id == i)
				return true;
		}
		return false;
	}

}
